<%-- 
    Document   : index
    Author     : Jagadeesh
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.*" %>
<%@page import="model.Koperasi" %>
<%@page import="database.DBClass"%>
<%@page import="validation.ValidateKoperasi"%>
<%@ page import ="java.sql.*" %>
<%


//    if (request.getAttribute("akun")!="admin"){
//        response.sendRedirect("view.jsp");
//    }
    Koperasi kop;
    kop = new Koperasi();
    //get request from servlet if data is invalid
    if (request.getAttribute("error") != null) {
        kop = (Koperasi) request.getAttribute("error");
    }
    if (request.getAttribute("updateuser") != null) {
        kop = (Koperasi) request.getAttribute("updateuser");
    }

    if (session.getAttribute("akun") == null) {
        System.out.println(request.getContextPath() + "/admin/login.jsp");
        response.sendRedirect(request.getContextPath() + "/admin/login.jsp");
    }
    DBClass dbobject = new DBClass();
    List list = dbobject.getKota();

%>
<html>
    <head>
        <style type="text/css">
            body {
                background-color:black;
                background-image:url(images/4.jpg); 
            }
        </style>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="<%request.getContextPath();%>/E-Stonion/css/metro-bootstrap.css" rel="stylesheet"> 
        <link href="<%request.getContextPath();%>/E-Stonion/css/metro-bootstrap-responsive.css" rel="stylesheet">

        <script src="<%request.getContextPath();%>/E-Stonion/js/jquery/jquery.min.js"></script>
        <script src="<%request.getContextPath();%>/E-Stonion/js/jquery/jquery.widget.min.js"></script>

        <script src="<%request.getContextPath();%>/E-Stonion/js/metro/metro-*.js"></script>
        <title><%=kop.getActionk()%> Page</title>
    </head>
    <body class="metro">
    <nav class="navigation-bar">
        <nav class="navigation-bar-content">
            <a class="element" href="/E-Stonion/home.jsp">
                <span class="icon-grid-view"></span>
                E-Stonion </a>


            <span class="element-divider"></span>
            <a class="element" href="viewproduk">View Produk</a>
            <a class="element" href="insertproduk">Insert Produk</a>
            <a class="element" href="viewkoperasi">View Koperasi</a>
            <a class="element" href="insertkoperasi">Insert Koperasi</a>
            <span class="element-divider"></span>
            <a class="element place-right" href="LoginServlet?action=logout">Logout</a>
            <span class="element-divider place-right"></span>
        </nav>
    </nav> 
    <form class="form" method="post" action="<%request.getContextPath();%>/E-Stonion/ControllerServletk">
        <CENTER>
            <TABLE border="0"width="600px">
                <TR>
                    <TD width="150px">Nama Koperasi</TD>
                    <TD>:</TD><TD>
                        <INPUT TYPE="text" NAME="namakoperasi" value="<%=kop.getnamakoperasi()%>">
                    </TD>
                    <TD width="350px">
                        <p class="text-alert"><%=kop.getnamakoperasiError()%> &nbsp;</p>
                    </TD>
                </TR>
                <TR>
                    <TD width="150px">Alamat Koperasi</TD>
                    <TD>:</TD><TD>
                        <INPUT TYPE="text" NAME="alamatkoperasi" value="<%=kop.getalamatkoperasi()%>">
                    </TD>
                    <TD>
                        <p class="text-alert"><%=kop.getalamatkoperasiError()%> </p>
                    </TD>
                </TR>
                <TR>
                    <TD width="150px">Deskripsi Koperasi</TD>
                    <TD>:</TD><TD>
                        <textarea NAME="deskripsikoperasi" value="<%=kop.getdeskripsikoperasi()%>"><%=kop.getdeskripsikoperasi()%></textarea>
                    </TD>
                    <TD>
                        <p class="text-alert"><%=kop.getdeskripsikoperasiError()%> </p>
                    </TD>
                </TR>
                <TR>
                    <TD width="150px">No Telp Koperasi</TD>
                    <TD>:</TD><TD>
                        <INPUT TYPE="text" NAME="notelpkoperasi" value="<%=kop.getnotelpkoperasi()%>">
                    </TD>
                    <TD>
                        <p class="text-alert"><%=kop.getnotelpkoperasiError()%> </p>
                    </TD>
                </TR>
                <TR>
                    <TD><INPUT TYPE="hidden" NAME="idkoperasi" value="<%=kop.getidkoperasi()%>"></TD>
                </TR>
                <TR>
                    <TD width="150px">Kota Koperasi</TD>
                    <TD>:</TD><TD>

<!--                            <INPUT TYPE="text" NAME="jenisproduk" value="<%=kop.getKota()%>">-->
                        <select id="kotakoperasi" name="kotakoperasi">
                            <%
                                if (list != null) {
                                    for (int i = 0; i < list.size(); i++) {
                                        Koperasi ukoperasi = (Koperasi) list.get(i);

                            %>
                            <option value="<%=ukoperasi.getKota()%>"><%=ukoperasi.getKota()%></option>
                            <%
                                    }
                                }
                            %>
                        </select>
                    </TD>
                </TR>
                <TR>
                    <TD colspan="2" align="center">
                        <INPUT TYPE="submit" value="<%=kop.getActionk()%>" name="actionk">
                    </TD>
                    <TD>
                        &nbsp;
                    </TD>
                </TR>
            </TABLE>
        </CENTER>
    </form>
</body>
</html>
